<template>
  <ContentWrap>
    <el-form
      class="-mb-15px"
      :model="queryParams"
      ref="queryFormRef"
      :inline="true"
      label-width="68px"
    >
      <el-form-item label="流程标识" key="key">
        <el-input v-model="queryParams.key" />
      </el-form-item>
      <el-form-item label="流程名称" key="name">
        <el-input v-model="queryParams.name" />
      </el-form-item>
      <el-form-item>
        <el-button @click="handleQuery"><icon icon="ep:search" class="mr-5px" />搜索</el-button>
      </el-form-item>
    </el-form>
  </ContentWrap>
  <ContentWrap>
    <el-table v-loading="loading" :data="list">
      <el-table-column label="流程标识" align="center" prop="key" width="200" />
      <el-table-column label="操作" align="center" width="240" fixed="right">
        <template #default="scope">
          <el-button link type="primary" @click="handleDesign(scope.row)"> 设计流程 </el-button>
        </template>
      </el-table-column>
    </el-table>
  </ContentWrap>
</template>

<script setup lang="ts" name="workIndex">
import * as ModelApi from '@/api/bpm/model'
const { push } = useRouter() // 路由
const queryParams = reactive({
  name: undefined,
  key: undefined,
  pageNo: 1,
  pageSize: 10
})
const loading = ref<boolean>(false)
const list = ref([]) // 列表的数据
const total = ref(0)
const handleQuery = () => {
  console.log(12)
}
/** 查询列表 */
const getList = async () => {
  loading.value = true
  try {
    const data = await ModelApi.getModelPage(queryParams)
    list.value = data.list
    total.value = data.total
  } finally {
    loading.value = false
  }
}
const handleDesign = (row) => {
  console.log(row)
  push({
    name: 'work',
    query: {
      modelId: row.id
    }
  })
}
onMounted(() => {
  getList()
})
</script>
<style lang="scss"></style>
